package com.zjitc.service;

import com.zjitc.common.ServerResponse;
import com.zjitc.model.User;

import javax.servlet.http.HttpSession;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/27 16:01
 * @description:
 */

public interface UserService {

  /**
   * 登录
   * @param username
   * @param password
   * @return
   */
  ServerResponse<User> login(String username, String password);

  /**
   * 注册
   * @param user
   * @return
   */
  ServerResponse<User> register(User user);

  /**
   * 检查用户名是否有效  不修改
   * @param str
   * @param type
   * @return
   */
  ServerResponse<User> checkValid(String str, String type);

  /**
   * 获取当前登录用户的详细信息，并强制登录
   * @param user
   * @return
   */
  ServerResponse<User> getInformation(User user);

  /**
   * 忘记密码
   * @param username
   * @return
   */
  ServerResponse<User> forgetPassword(String username);

  /**
   * 登录状态更新个人信息
   * @param email
   * @param phone
   * @param question
   * @param answer
   * @param user
   * @return
   */
  ServerResponse updateInformation(String email, String phone, String question, String answer,
      User user);

  /**
   * 登录状态重置密码
   * @param passwordOld
   * @param passwordNew
   * @param session
   * @return
   */
  ServerResponse resetPassword(String passwordOld, String passwordNew, HttpSession session);

  /**
   * 忘记密码的提交答案
   * @param username
   * @param question
   * @param answer
   * @return
   */
  ServerResponse<User> forgetCheckAnswer(String username, String question, String answer);

  /**
   * 忘记密码的重设密码
   * @param username
   * @param passwordNew
   * @param forgetToken
   * @return
   */
  ServerResponse<User> forgetResetPassword(String username, String passwordNew, String forgetToken);

  /**
   * 后台管理员登陆
   * @param username
   * @param password
   * @param session
   * @return
   */
  ServerResponse<User> backLogin(String username, String password, HttpSession session);

  /**
   * 获取所有用户信息
   * @param pageNum
   * @param pageSize
   * @param session
   * @return
   */
  ServerResponse<User> list(Integer pageNum, Integer pageSize, HttpSession session);


}
